package com.yibo.user.service;

import com.yibo.db.helper.QueryFilter;
import com.yibo.db.user.entity.UserInfo;
import com.yibo.user.object.RegisterUser;
import com.yibo.user.object.UpUser;
import com.yibo.user.object.YBUser;
import com.yibo.user.service.user.*;
import javassist.bytecode.ByteArray;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.ByteArrayOutputStream;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Override
    public YBUser loginByPassword(String userId, String password) {
        return new LoginByPasswordCommand(userId,password).execute();
    }

    @Override
    public YBUser loginByPhone(String phone, String checkWord) {
        return null;
    }

    @Override
    public YBUser loginByEmail(String email, String checkWord) {
        return new LoginByEmailCheckWordCommand(email,checkWord).execute();
    }

    @Override
    public YBUser queryLoginUser() {
        return new QueryLoginUserCommand().execute();
    }

    @Override
    public int loginOut() {
        return new LoginOutCommand().execute();
    }

    @Override
    public int reSetPasswordByEmail(String email, String checkWord, String password) {
        return 0;
    }

    @Override
    public int reSetPasswordByPhone(String phone, String checkWord, String password) {
        return 0;
    }

    @Override
    @Transactional
    public int register(RegisterUser user) {
        return new RegisterUserCommand(user).execute();
    }

    @Override
    public int pullBack(String userId) {
        return 0;
    }

    @Override
    public int remove(String userId) {
        return 0;
    }

    @Override
    public int updateUser(UpUser user) {
        return 0;
    }

    @Override
    public QueryFilter<List<UserInfo>> queryUserList(QueryFilter queryFilter) {
        return null;
    }
}
